<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>工作时间模板</title>
    <%@include file="/common/commonCSS.jsp" %>
    <%@include file="/common/commonJS.jsp" %>
    <%@include file="/WEB-INF/jsp/include/taglib.jsp" %>
</head>

<body>
    <div class="main-container" id="main-container">

        <div class="row" style="margin-top: 20px;">
            <div class="col-md-12">
                <form class="layui-form" id="search-from" action="${webRoot}/sys/timetblworktime/list">
                    <div class="layui-form-item">
                        <%--<label class="layui-form-label" style="width:6%;">名称:</label>--%>
                        <button class="layui-btn layui-btn-danger layui-btn-small" type="button" onclick="addTimetblworktime()"><i class="layui-icon">&#xe61f;</i> 新 增</button>
                        <%--<a class="layui-btn" href="${webRoot}/sys/timetblworktime/info"><i class="layui-icon">&#xe61f;</i> 新 增</a>--%>
                    </div>
                </form>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <table id="table-list" class="layui-table">
                    <thead>
                        <tr>
                            <th>周一上下班时间</th>
                            <th>周二上下班时间</th>
                            <th>周三上下班时间</th>
                            <th>周四上下班时间</th>
                            <th>周五上下班时间</th>
                            <th>周六上下班时间</th>
                            <th>周日上下班时间</th>
                            <th>操作</th>

                        </tr>
                    </thead>
                    <tbody>
                        <c:forEach items="${timetblWorktimeList}" var="timetblWorktime" varStatus="i">
                            <tr id="${timetblWorktime.id }">
                                <td style='display: none'>
                                    <input name='timetblWorktimeIds' value='${timetblWorktime.id}'/>
                                </td>
                                <td>${timetblWorktime.monStarttime}-${timetblWorktime.monEndtime}</td>
                                <td>${timetblWorktime.tuesStarttime}-${timetblWorktime.tuesEndtime}</td>
                                <td>${timetblWorktime.wenStarttime}-${timetblWorktime.wenEndtime}</td>
                                <td>${timetblWorktime.thursStarttime}-${timetblWorktime.thursEndtime}</td>
                                <td>${timetblWorktime.friStarttime}-${timetblWorktime.friEndtime}</td>
                                <td>${timetblWorktime.satStarttime}-${timetblWorktime.satEndtime}</td>
                                <td>${timetblWorktime.sunStarttime}-${timetblWorktime.sunEndtime}</td>
                                <td>
                                    <div class=" btn-group ">
                                        <button class="layui-btn layui-btn-danger layui-btn-small" type="button" onclick="addTimetblworktime('${timetblWorktime.id}')"><i class="layui-icon">&#xe61f;</i> 编辑</button>
                                        <%--<c:if test="${timetblInfo.status == 1}">--%>
                                                  <button class="layui-btn layui-btn-danger layui-btn-small" type="button" onclick="deleteWorktimeById('${timetblWorktime.id}')"><i class="layui-icon">&#xe640;</i>删除</button>
                                        <%--</c:if>--%>


                                    </div>
                                </td>
                            </tr>
                        </c:forEach>
                    </tbody>
                </table>

            </div>
        </div>
    </div>
</body>
<script src="${webRoot}/js/activiti/actSumbit.js"></script>
<script>
    function deleteWorktimeById(id) {
        var url ="${webRoot}/sys/timetblworktime/delete";
        confirm('确定要删除选中的记录？', function(){
            $.post(url,"id="+id,function (r) {
                if(r.code=='0'){
                    toast(r.msg);
                    $("#"+id+"").remove();
                    <%--location.href='${webRoot}/sys/timetblworktime/list';--%>
                }else {
                    alertMsg(r.msg);
                }
            });
        });
    }

    function addTimetblworktime(timetblworktimeId) {
        var url="${webRoot}/sys/timetblworktime/info"+(timetblworktimeId==undefined?"":"?id="+timetblworktimeId)
        //弹框层
        layer.open({
            scrollbar: true,
            type: 2,
            title : ['添加' , true],
            area: ['90%', '90%'], //宽高
            content: [url],
            shadeClose : false,
        });
    }
</script>

</html>